package org.darkforest.common.services.impl;

import org.darkforest.common.services.StoreNavigationService;
import org.darkforest.dao.mapper.StoreNavigationMapper;
import org.darkforest.model.StoreNavigation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Libing on 2015/9/28.
 */
@Service
public class StoreNavigationServiceImpl implements StoreNavigationService {

    @Autowired
    private StoreNavigationMapper storeNavigationMapper;

    /**
     * 店铺导航列表
     *
     * @return
     * @param storeId
     */
    @Override
    public List<StoreNavigation> findStoreNavigationList(Integer storeId) {
        return storeNavigationMapper.findStoreNavigationList(storeId);
    }

    /**
     * 新增店铺导航
     *
     * @param storeNavigation
     * @return
     */
    @Override
    public int addNavigation(StoreNavigation storeNavigation) {
        return storeNavigationMapper.insertSelective(storeNavigation);
    }

    /**
     * 删除店铺导航
     *
     * @param id
     * @return
     */
    @Override
    public int delNavigationById(Integer id) {
        return storeNavigationMapper.deleteByPrimaryKey(id);
    }

    /**
     * 根据主键获取店铺导航信息
     *
     * @param id
     * @return
     */
    @Override
    public StoreNavigation getNavigationById(Integer id) {
        return storeNavigationMapper.selectByPrimaryKey(id);
    }

    /**
     * 更新店铺导航信息
     *
     * @param storeNavigation
     * @return
     */
    @Override
    public int editNavigation(StoreNavigation storeNavigation) {
        return storeNavigationMapper.updateByPrimaryKeySelective(storeNavigation);
    }
}
